# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=bison
pkgver=3.0.5
pkgrel=1
pkgdesc="The GNU general-purpose parser generator"
arch=('i686' 'x86_64')
license=('GPL3')
url="https://www.gnu.org/software/bison/bison.html"
depends=('m4' 'sh')
groups=('base-devel')
options=('staticlibs')
makedepends=('flex')
install=bison.install
source=(https://ftp.gnu.org/gnu/bison/${pkgname}-${pkgver}.tar.xz{,.sig}
        bison-3.0.5-msys2.patch
        bison-3.0.5-gettext-0.19.patch)
sha256sums=('075cef2e814642e30e10e8155e93022e4a91ca38a65aa1d5467d4e969f97f338'
            'SKIP'
            '012c3055c57a83525b05fd51056b949810a3289335e0accdb74d55d32648dddc'
            '100f3ff1cd68a080b803a4f4a86a0a11b660e2b3b89f7ec95afa0437ee2b2b5c')

prepare() {
  cd ${srcdir}/${pkgname}-${pkgver}
  patch -p1 -i ${srcdir}/bison-3.0.5-msys2.patch
  patch -p1 -i ${srcdir}/bison-3.0.5-gettext-0.19.patch

  autoreconf -vfi
}

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
  ./configure --prefix=/usr
  make
}

check() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make check
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install
}
